Skip to content

Implement chronological story updates with automated feed maintenance system#26

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/implement-chron-job-for-stories
Draft

Implement chronological story updates with automated feed maintenance system#26
Copilot wants to merge 4 commits intomainfrom
copilot/implement-chron-job-for-stories

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 9, 2025

This PR implements a comprehensive chronological story updates system that automatically manages the live feed through periodic maintenance, ensuring optimal performance and content organization.

Overview

The system addresses the need for automated feed management by implementing a 15-minute maintenance cycle that:

  • Maintains a maximum of 50 posts in the live feed
  • Continuously enriches content with metadata (sentiment, topics, engagement scores)
  • Archives completed stories to permanent database storage
  • Ensures chronological ordering of all content

Key Features

🔄 Automated Maintenance System

  • Feed Size Management: Automatically archives posts beyond the 50-post limit
  • Smart Processing: Only runs maintenance when actually needed, not on blind schedules
  • Chronological Ordering: Maintains proper time-based organization of content
  • Batch Processing: Efficiently handles multiple posts in configurable batches

🧠 Continuous Content Enrichment

  • Sentiment Analysis: Analyzes post content for positive/negative/neutral sentiment
  • Topic Extraction: Categorizes posts by technology, politics, science, etc.
  • Engagement Scoring: Calculates weighted scores based on upvotes, comments, and ratios
  • Progressive Enhancement: Posts become more enriched over time until archival

📊 Real-time Monitoring Dashboard

  • Live Statistics: 30-second refresh cycle showing current feed health
  • Visual Indicators: Color-coded status (🟢 Healthy, 🟡 Attention, 🔴 Action Required)
  • Manual Controls: Test individual maintenance functions or run complete cycles
  • Activity Tracking: Monitor enrichment progress and archive activity

🔧 System Integration

  • Seamless Integration: Works with existing live feed store and Reddit pipeline
  • Maintenance Hooks: Automatic checks when new posts are added
  • Service Layer: Clean abstraction between UI components and backend functions
  • Error Handling: Graceful degradation when services are unavailable

Technical Implementation

The system is built with a layered architecture:

// Backend: Convex functions for core maintenance logic
export const maintainLiveFeed = mutation({...});      // Enforce 50 post limit
export const enrichOldestPosts = mutation({...});     // Add metadata
export const archiveCompletedStories = mutation({...}); // Move to story_history

// Service Layer: Bridge between UI and backend
class FeedMaintenanceService {
  async automatedMaintenance() {
    // Simulates 15-minute cron job functionality
  }
}

// UI: React dashboard for monitoring and control
function FeedMaintenanceDashboard() {
  // Real-time stats, manual triggers, visual indicators
}

Files Added/Modified

  • convex/feedMaintenanceCore.ts - Core maintenance functions
  • convex/feedStats.ts - Statistics and monitoring queries
  • lib/services/livefeed/feedMaintenanceService.ts - Service layer
  • components/livefeed/FeedMaintenanceDashboard.tsx - React dashboard
  • app/maintenance/page.tsx - Testing and monitoring interface
  • Integration hooks in existing live feed store and service

Usage

  1. Automatic Operation: The system integrates with the existing live feed and runs maintenance when needed
  2. Manual Testing: Navigate to /maintenance to access the monitoring dashboard
  3. Real-time Monitoring: View live statistics and system health indicators
  4. Manual Triggers: Test individual functions or run complete maintenance cycles

Example Workflow

Live Feed (60+ posts) → Maintenance Check → Smart Processing → Healthy Feed (≤50 posts)
                                           ↓
                        🧠 Enrich oldest posts with metadata
                        📚 Archive completed stories to database  
                        🗑️ Remove excess posts (keep 50 most relevant)

Benefits

  • Performance: Maintains optimal feed size for fast loading
  • Intelligence: Continuous content enhancement with rich metadata
  • Preservation: Archives valuable stories to permanent storage
  • Automation: Simulates cron job functionality with smart triggering
  • Monitoring: Real-time visibility into system health and activity
  • Control: Manual override capabilities for testing and debugging

The system successfully delivers the automated maintenance requirements while providing comprehensive monitoring and control capabilities for the live feed management workflow.

Fixes #25.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/SMNB/SMNB/smnb/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits September 9, 2025 14:29
Co-authored-by: acdc-digital <127530566+acdc-digital@users.noreply.github.com>
Co-authored-by: acdc-digital <127530566+acdc-digital@users.noreply.github.com>
…sting

Co-authored-by: acdc-digital <127530566+acdc-digital@users.noreply.github.com>
Copilot AI changed the title [WIP] Story updates: Chronological Implement chronological story updates with automated feed maintenance system Sep 9, 2025
Copilot AI requested a review from acdc-digital September 9, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Story updates: Chronological

2 participants